package com.jhs.boot.system.converter;

import com.jhs.boot.common.model.Option;
import com.jhs.boot.system.model.entity.Role;
import com.jhs.boot.system.model.entity.User;
import com.jhs.boot.system.model.vo.GraphNodeVO;
import com.jhs.boot.system.model.vo.NodesVO;
import com.jhs.boot.system.model.vo.SysNodesVO;
import org.mapstruct.Mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jhs.boot.system.model.entity.SysNodes;
import com.jhs.boot.system.model.form.SysNodesForm;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 节点对象转换器
 *
 * @author zxy
 * @since 2025-08-11 19:17
 */
@Mapper(componentModel = "spring")
public interface SysNodesConverter{

    SysNodesForm toForm(SysNodes entity);

    SysNodes toEntity(SysNodesForm formData);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "ip")
    })
    Option<String> toOption(SysNodes role);

    List<Option<String>> toOptions(List<SysNodes> list);

    NodesVO toNodeOption(SysNodes sysNodes);
    NodesVO toNodeOptionBySysNodesVO(SysNodesVO sysNodes);

    List<GraphNodeVO> toGraphNodeVOEnty(List<SysNodes> list);
}